package com.spzx.product.controller;

import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.product.domain.Category;
import com.spzx.product.service.CategoryService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:CategoryController
 * Package:com.spzx.product.controller
 * Description:
 *
 * @Author:helei
 * @Create:2024/9/20 - 14:08
 */
@Tag(name = "商品分类接口管理")
@RestController
@RequestMapping("/category")
public class CategoryController extends BaseController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 获取商品分类下拉树列表
     * @param parentId
     * @return
     */
    @GetMapping("/treeSelect/{parentId}")
    public AjaxResult treeSelect(@PathVariable Long parentId) {
        List<Category> categoryList = categoryService.treeSelect(parentId);
        return AjaxResult.success(categoryList);
    }
}
